#include "Boot.h"

EFI_STATUS
EFIAPI
UefiMain(
    IN EFI_HANDLE ImageHandle,
    IN EFI_SYSTEM_TABLE *SystemTable
)
{
    EFI_STATUS Status = EFI_SUCCESS;   
    FrameBufferConfig VideoConfig;

    Status = VideoInit(ImageHandle, &VideoConfig);

    EFI_PHYSICAL_ADDRESS KernelEntryPoint;
    Status = Relocate(ImageHandle, L"\\Kernel.elf", &KernelEntryPoint);
    BOOT_CONFIG BootConfig;
    
    BootConfig.VideoConfig= VideoConfig;

    UINT64 (*KernelEntry)(BOOT_CONFIG *BootConfig);
    KernelEntry = (UINT64 (*)(BOOT_CONFIG *BootConfig))KernelEntryPoint;
    
    UINT64 PassBack = KernelEntry(&BootConfig);
    Print(L"PassBack=%lx.\n", PassBack);
    //Never return here
    return Status;
}